package com.jl.jlapp.mvp.activity;

import android.content.Intent;
import android.graphics.Bitmap;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;
import android.widget.ImageView.ScaleType;
import android.widget.RelativeLayout;

import butterknife.BindView;
import butterknife.ButterKnife;

import com.bm.library.Info;
import com.bm.library.PhotoView;
import com.bumptech.glide.Glide;
import com.bumptech.glide.RequestBuilder;
import com.bumptech.glide.RequestManager;
import com.bumptech.glide.request.RequestOptions;
import com.bumptech.glide.request.target.SimpleTarget;
import com.bumptech.glide.request.transition.Transition;
import com.jl.jlapp.R;

public class PhotoViewActivity extends AppCompatActivity {
    AlphaAnimation in = new AlphaAnimation(0.0F, 1.0F);
    @BindView(R.id.bg)
    ImageView mBg;
    Info mInfo;
    @BindView(R.id.img)
    PhotoView mPhotoView;
    AlphaAnimation out = new AlphaAnimation(1.0F, 0.0F);
    @BindView(R.id.parent_photo_view)
    RelativeLayout parentPhotoView;

    protected void onCreate(@Nullable Bundle paramBundle) {
        super.onCreate(paramBundle);
        setContentView(R.layout.activity_photo_view);
        ButterKnife.bind(this);
        this.mPhotoView.setScaleType(ScaleType.CENTER_INSIDE);
        this.in.setDuration(300L);
        this.out.setDuration(300L);
        this.out.setAnimationListener(new AnimationListener() {
            public void onAnimationEnd(Animation paramAnonymousAnimation) {
                PhotoViewActivity.this.mBg.setVisibility(View.INVISIBLE);
            }

            public void onAnimationRepeat(Animation paramAnonymousAnimation) {
            }

            public void onAnimationStart(Animation paramAnonymousAnimation) {
            }
        });
        this.mPhotoView.enable();
        this.mPhotoView.setOnClickListener(new OnClickListener() {
            public void onClick(View paramAnonymousView) {
                PhotoViewActivity.this.mBg.startAnimation(PhotoViewActivity.this.out);
                PhotoViewActivity.this.mPhotoView.animaTo(PhotoViewActivity.this.mInfo, new Runnable() {
                    public void run() {
                        PhotoViewActivity.this.finish();
                    }
                });
            }
        });
        Intent intent = getIntent();
        String str = intent.getStringExtra("picUrl");
        int i = intent.getIntExtra("flag", 0);
        this.mInfo = this.mPhotoView.getInfo();
        String url = str;
        if (i == 0) {
            url = "http://117.158.178.202:8001/JLMIS/" + str;
        }
        Glide.with(this).asBitmap().apply(new RequestOptions().placeholder(R.drawable.img_lose_m).error(R.drawable.img_lose_m)).load(paramBundle).into(new SimpleTarget() {
            @Override
            public void onResourceReady(@NonNull Object resource, @Nullable Transition transition) {
                PhotoViewActivity.this.mPhotoView.setImageBitmap((Bitmap) resource);
                PhotoViewActivity.this.mBg.startAnimation(PhotoViewActivity.this.in);
                PhotoViewActivity.this.mBg.setVisibility(View.VISIBLE);
                PhotoViewActivity.this.parentPhotoView.setVisibility(View.VISIBLE);
                PhotoViewActivity.this.mPhotoView.animaFrom(PhotoViewActivity.this.mInfo);
            }
        });
    }
}


/* Location:              /Users/davidzhang/Documents/decompileApk/jlfood-dex2jar.jar!/com/jl/jlapp/mvp/activity/PhotoViewActivity.class
 * Java compiler version: 6 (50.0)
 * JD-Core Version:       0.7.1
 */